﻿using System;
using Hopscotch.Common.Logging;
using Microsoft.AspNet.SignalR.Client;
using Hopscotch.Common.Contracts.EnqService;

namespace Hopscotch.Presentation.Communication.HubClients
{
	public class DiagnosticsHubClient : IDiagnosticsEnqService
	{
		static readonly ILogger logger = AppLogger.CreateLogger<DiagnosticsHubClient>();

		public DiagnosticsHubClient(IHubProxy hubProxy)
		{
			hubProxy.On("heartbeat", OnHeartbeatReceived);
		}

		private void OnHeartbeatReceived()
		{
			logger.Debug("Heartbeat received");
		}

		public string Ping()
		{
			return string.Format("Hello\n{0}", this.GetType().Name);
		}
	}
}
